package com.ymatou.auth.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*用户在指定时间内登陆失败的次数接口Call
*FreeMaker Template自动生成代码
*/
public class LoginLimitRequestDtoCall extends YmatouBaseCall{
	private static String opurl ="json/reply/LoginLimitRequestDto";
	
	public LoginLimitRequestDtoCall() {
		super(EnvSetup.getSystemUrl("api_auth"), opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String response = null;
		String code = null;
		try {
			response = new JSONObject(getReturnData()).getString("ResponseStatus");
			code = new JSONObject(response).getString("ErrorCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String response = null;
		String msg = null;
		try {
			response = new JSONObject(getReturnData()).getString("ResponseStatus");
			msg = new JSONObject(response).getString("Message");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return msg;
	}
	
}